﻿<cfsilent>
	<cfscript>
	
		sql = "SELECT 
					a.institute_id, 
					b.institute_name, 
					count(*) tea_count
				FROM t_teacher a 
					INNER JOIN t_institute b ON b.institute_id = a.institute_id 
				WHERE 
					b.classification = '1'
				GROUP BY a.institute_id, b.institute_name
				ORDER BY b.institute_name";
				
		queryObj = new query( datasource=application.dnsSlave );
		
		rs_ins = queryObj.execute( sql=sql ).getResult();
		
		sql = "SELECT 
					a.institute_id, 
					b.institute_name, 
					count(*) tea_count
				FROM t_teacher a 
					INNER JOIN t_institute b ON b.institute_id = a.institute_id 
				WHERE 
					b.classification = '3'
				GROUP BY a.institute_id, b.institute_name
				ORDER BY b.institute_name";
				
		queryObj = new query( datasource=application.dnsSlave );
		
		rs_dep = queryObj.execute( sql=sql ).getResult();

		sql = "SELECT 
					a.institute_id, 
					b.institute_name, 
					count(*) tea_count
				FROM t_teacher a 
					INNER JOIN t_institute b ON b.institute_id = a.institute_id 
				WHERE 
					b.classification NOT IN ('1','3')
				GROUP BY a.institute_id, b.institute_name
				ORDER BY b.institute_name";
				
		queryObj = new query( datasource=application.dnsSlave );
		
		rs_other = queryObj.execute( sql=sql ).getResult();
		
		currentTab = event.getArg("TabID", "labInstitute");
		
		event.setArg("pageTitle", "师资工作量 - 组织机构");

		passArgs = structNew();
		
		/* 搜索教师档案 */
		keyword = event.getArg("Keywords");
		
		rs_teacherSearch = queryNew("rs_teacherSearch");
		
		if ( len(keyword) ) {
		
			sql = "SELECT 
					a.tch_id, a.tch_name, 
					b.institute_name, b.institute_id
					FROM t_teacher a 
						INNER JOIN t_institute b ON b.institute_id = a.institute_id  
					WHERE 
						a.tch_name LIKE :condition 
						OR 
						a.tch_id LIKE :condition  
					ORDER BY a.tch_name";
					
			queryObj = new query( datasource=application.dnsSlave ,maxRows = 60 );
			queryObj.addParam( name="condition", value=keyword&"%", cfsqltype="cf_sql_varchar" );
			
			rs_teacherSearch = queryObj.execute( sql=sql ).getResult();
			
		}

	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
				<a class="uiButton" href="<cfoutput>#buildURL('DEFAULT_EVENT')#</cfoutput>"><i class="mrs img btnPublish"></i><span class="uiButtonText">师资与教学工作量</span></a>
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 link"></i>选择教师所在部门
				</h2>
			</div>
		</div>
	</div>
</div>

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="administration">
				<div class="UItab">
					<div class="tabLables">
						<span <cfif currentTab eq "labInstitute">class="active"</cfif> id="labInstitute" tabTarget="Institute">二级学院(系)部及教辅部门</span>
						<!---<span <cfif currentTab eq "labDepartment">class="active"</cfif> id="labDepartment" tabTarget="Department">其他校内非教学单位</span>--->
						<span <cfif currentTab eq "labSearch">class="active"</cfif> id="labSearch" tabTarget="Search">搜索教师档案</span>
					</div>
				</div>
				<script language="javascript" type="text/javascript">
					//<![CDATA[
					<!--
					$(document).ready(function() {
						
						/* init Tab */
						$("div.tabContent").hide();
						$("div#" + $("div.tabLables span.active").attr("tabTarget")).show();
						
						$("div.tabLables > span").click(function(){
							var $targetID = $(this).attr("tabTarget");
							
							$("div.tabLables span").removeClass("active");
							$(this).addClass("active");
							
							$("div.tabContent").not('[id="' + $targetID + '"]').hide();
							$("div.tabContent#" + $targetID).show();
						});
						
					});
					// -->
					//]]>				
				</script>
			</div>
			
			<div id="Institute" class="tabContent">
				
				<div class="noticeBlock">
					<h3>二级院(系)</h3>
					<p><span class="img icon16x16 message"></span>这里列出所有承担教学任务的校内学院, 同时这些院系设有学生工作系统, 承担学生日常管理工作</p>
					<hr/>
				</div>
				
				<div class="clearfix">
					<div class="UICardTable">
                        <cfloop query="rs_ins"  >
							<cfset structInsert(passArgs, "DepID", rs_ins.institute_id, true) />
							<dl>
								<dt>
									<a href="<cfoutput>#buildURL('instituteTeacher', passArgs)#</cfoutput>">
									<b class="school"><!--imgholder--></b>
									<dd>
										<h3><cfoutput>#rs_ins.institute_name#</cfoutput></h3>
										<div>注册职工 <cfoutput>#rs_ins.tea_count#</cfoutput> 名</div>
									</dd>
									</a>
								</dt>
							</dl>
						</cfloop>
					</div>
				</div>
				
				<!---<div class="noticeBlock">
					<h3>教辅部门</h3>
					<p><span class="img icon16x16 message"></span>教辅单位不承担学生生活管理工作, 也没有设置招生专业. 仅仅承担相关课程的教学工作.</p>
					<hr/>
				</div>
				
				<div class="clearfix">
					<div class="UICardTable">
                        <cfloop query="rs_dep"  >
							<cfset structInsert(passArgs, "DepID", rs_dep.institute_id, true) />
							<dl>
								<dt>
									<a href="<cfoutput>#buildURL('instituteTeacher', passArgs)#</cfoutput>">
									<b class="depart"><!--imgholder--></b>
									<dd>
										<h3><cfoutput>#rs_dep.institute_name#</cfoutput></h3>
										<div>注册职工 <cfoutput>#rs_dep.tea_count#</cfoutput> 名</div>
									</dd>
									</a>
								</dt>
							</dl>
						</cfloop>
					</div>
				</div>	--->
			
			</div>

			<div id="Department" class="tabContent">
				
				<div class="noticeBlock">
					<h3>学校其他部门</h3>
					<p><span class="img icon16x16 message"></span>其他没有参与学校教学管理工作的部门.</p>
					<hr/>
				</div>
				
				<div class="clearfix">
					<div class="UICardTable">
                        <cfloop query="rs_other" >
							<cfset structInsert(passArgs, "DepID", rs_other.institute_id, true) />
							<dl>
								<dt>
									<a href="<cfoutput>#buildURL('instituteTeacher', passArgs)#</cfoutput>">
									<em><!--imgholder--></em>
									<dd>
										<h3><cfoutput>#rs_other.institute_name#</cfoutput></h3>
										<div>注册职工 <cfoutput>#rs_other.tea_count#</cfoutput> 名</div>
									</dd>
									</a>
								</dt>
							</dl>
						</cfloop>
					</div>
				</div>	
				
			</div>
			
			<div id="Search" class="tabContent">
					
				<form id="formSearch" onSubmit="javascript:return processVerfiyForm('formSearch');" class="formWrapper Transparent" method="post" action="<cfoutput>#buildURL('teacherDocument')#</cfoutput>">
					<input type="hidden" name="TabID" value="labSearch" />
						
					<div class="label">
						<b>工号或姓名</b>
						<input name="Keywords" id="Keywords" type="text" class="typeText" verification="required" maxlength="128" value="<cfoutput>#event.getArg('Keywords')#</cfoutput>" />
					</div>
					<hr/>
					<div class="lable">
						<input class="button1" type="submit" value="搜索" />
					</div>
					
				</form>
					
				<cfif rs_teacherSearch.recordCount>

					<div class="clearfix">
                        <cfloop query="rs_teacherSearch"  >
							<cfset structInsert( passArgs, "TCHID", rs_teacherSearch.tch_id, true) />
							<cfset structInsert( passArgs, "DepID", rs_teacherSearch.institute_id, true) />
							<div class="UISmallUserCard">
								<div class="cardContent">
									<a href="<cfoutput>#buildURL('teacherProfile', passArgs)#</cfoutput>"><img class="img" src="<cfoutput>#getProperty('cdnServer')#</cfoutput><cfoutput>#getContextRoot()#</cfoutput>/acadmicRes/assets/graphic/userSmall.png" style="background-image: url('<cfoutput>#getContextRoot()#</cfoutput>/acadmicManager/teacher/portrait/<cfoutput>#rs_teacherSearch.tch_id#</cfoutput>.jpg');"></a>
									<div class="cardDetail">
										<h3><a href="<cfoutput>#buildURL('teacherProfile', passArgs)#</cfoutput>"><cfoutput>#rs_teacherSearch.tch_name#</cfoutput></a> <span class="uid">(<cfoutput>#rs_teacherSearch.tch_id#</cfoutput>)</span></h3>
										<p><cfoutput>#rs_teacherSearch.institute_name#</cfoutput></p>
									</div>
								</div>
							</div>
						</cfloop>
					</div>
					
				</cfif>
					
			</div>
			
		</li>
	</ul>
</div>

